<%@page import="entities.User"%>
<%@page import="auxilary.Links"%>
<%@page import="auxilary.Actions"%>
<%@ page language="java" contentType="text/html; charset=windows-1255"
    pageEncoding="windows-1255"%>
<%
	User user = (User)request.getSession().getAttribute("user");
	boolean loggedIn = (user != null);
%>    

<jsp:include page="/frames/start.jsp" />
	<%=Links.Css.COURSE %>
	<%=Links.Scripts.SEARCH %>
	<%=Links.Scripts.COURSE %>
<jsp:include page="/frames/frame.jsp" />
			<div class="tops">
				<a class="top" href ="<%=Links.Pages.COURSES_BASE %>">See all courses</a>
			   <% if ((loggedIn) && (user.isAdmin())) { %>
				<a class="top" href ="<%=Links.Pages.NEW_COURSE %>">Add a new course</a>
			   <% } %>
			</div>
			<h1>Find Courses</h1>
			<div class="search-bar">
				<form id="search-form" action="javascript:search()">
					<input name="query"  class="search" type="text" placeholder="Type your course search here..." autocomplete="off" value="" />
					<input type="hidden" name="action" value="<%=Actions.Course.SEARCH %>" />
					<div class="hidden-form">
						<b>Credits:</b>
						<input id="credits" name="credits" class="credits" type="text" />
						<select name="sign" id="sign">
							<option value="0">Exactly</option>
							<option value="1">Less or equal</option>
							<option value="2">More or equal</option>
						</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<b>Group:</b>
						<select name="group" id="group">
							<option value="-1" selected="selected" >Any</option>
							<jsp:include page="/helpers/groups.jsp"></jsp:include>
						</select>
						<input id="group-number" name="group-number" class="group-number" size="1" type="text" />
						<br /><br />
						<hr />
						<br />
						<input class="show-full" type="radio" name="show" value="1" checked="checked" />Find all matching courses
						<br />
					   <% if (loggedIn) { %>
						<input class="show-full" type="radio" name="show" value="2" />Find matching courses I can sign up to
						<br />
						<input class="show-full" type="radio" name="show" value="3" />Find matching courses that don't clash with my schedule
						<br />
					   <% } %>
						<input class="show-full" type="radio" name="show" value="4" />Find matching courses with empty slots
	
					</div>
					<center><div id="search-error" class="error"></div></center>
					<a id="show-advanced" href="javascript:toggleAdvanced()">Advanced Search...</a>
					<a id="show-basic" href="javascript:toggleAdvanced()">Basic Search...</a>
				</form>
			</div>
			<div id="search-table">
			</div>
<jsp:include page="/frames/end.jsp" />